package com.example.footballsystem.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.footballsystem.entity.Team;
import com.example.footballsystem.entity.TeamGame;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TeamGameMapper extends BaseMapper<TeamGame> {
    @Select("select * from teamgame")
    public List<TeamGame> getAllTeamGame();
    @Select("select * from teamgame where team1=#{teamID} || team2=#{teamID}")
    public List<TeamGame> getTeamGameByTeamID(int teamID);
    @Insert("insert into teamgame (time, gameName, team1, team2, score1, score2, teamGameID) VALUES (#{time},#{gameName},#{team1ID},#{team2ID},#{score1},#{score2},#{teamGameID})")
    public Boolean addTeamGame(TeamGame teamGame);
    @Delete("delete from teamgame where teamGameID=#{id}")
    public Boolean deleteTeamGame(int id);
}
